import 'package:gate_cli/utils/intl_view/utils/project_intl.dart';

class EditCommand {
  static void create({required String key, required Map<String, String> strings}) {
    for (var element in strings.entries) {
      final locale = element.key;
      final value = element.value;
      final arbFile = ProjectIntl.instance.getArb(locale);
      arbFile.saveAll({key: value});
    }
  }

  static void modify({required String key, required Map<String, String> strings}) {
    for (var element in strings.entries) {
      final locale = element.key;
      final value = element.value;
      final arbFile = ProjectIntl.instance.getArb(locale);
      arbFile.saveAll({key: value});
    }
  }

  static void delete({required String key}) {
    for (final arbFile in ProjectIntl.instance.arbFiles.values) {
      if (arbFile.strings.containsKey(key)) {
        arbFile.delete(key: key);
      }
    }
  }
}
